#include "OptionWidget.hpp"
#include <QApplication>
#include <QTranslator>

bool is_detect_jpg_code = false;

void outputMessage(QtMsgType type, const QMessageLogContext &context, const QString &msg)
{
    QString text;
    switch(type)
    {
        case QtDebugMsg:
            text = QString("Debug:");
            break;

        case QtWarningMsg:
            text = QString("Warning:");
            break;

        case QtCriticalMsg:
            text = QString("Critical:");
            break;

        case QtFatalMsg:
            text = QString("Fatal:");
    }

    QString message = text.append(msg);
    if(message.contains("Corrupt JPEG data"))
        is_detect_jpg_code = true;
}


int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    QTranslator tsor;           //创建翻译器
    tsor.load("zh_hans.qm");    //加载语言包
    a.installTranslator(&tsor); //安装翻译器
//    qInstallMessageHandler(outputMessage);

    OptionWidget w;
    w.show();

    return a.exec();
}
